/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tp_imag.model;

import java.io.Serializable;

/**
 *
 * @author Administrador
 */
public abstract class Filter {

    private int intensity;

    public Filter() {
        //Intensidad del filtro por default
        intensity = 1;
    }

    public Filter(int intensity) {
        this.intensity = intensity;
    }

    public void setIntensity(int intensity) {
        this.intensity = intensity;
    }
    
    public abstract float[] getParameters();

    protected float[] copyParameters(float[] values) {
    	if (values == null)
    		return null;
    	
        if (values.length <= 0) {
            return null;
        }
        float[] val = new float[values.length];
        for (int i = 0; i < values.length; i++) {
            val[i] = values[i];
        }

        return val;
    }

    public float[] getParameters(int intensity) {
        float[] values = copyParameters(getParameters());
        //values[4] = values[4] * intensity;
                
        if (values == null)
        	return null;
        
        
        values[4] = values[4] * intensity;
        //values[6] = values[6] * intensity;
        return values;
    }
    
    public float[] getValues() {
        return getParameters(intensity);
    }

    public abstract String getName();

    @Override
    public String toString() {
        return "Filtro: " + getName() + " - Intensidad: " + this.intensity;
    }


}
